# Importing Data
SLOVENIA<- read_excel("C:/users/Biniam/Desktop/Documents/Academic/Thesis/Analysis Folder/Excel Files/Aluminium/Aluminium.xlsx",sheet = "Sheet1", range = "AC1:AC229")

# Checking the Imported Data
View(SLOVENIA)
# Creating Time Series Data
SLOVENIA_ts <- ts(SLOVENIA, start=c(1998,1), end=c(2016,12), frequency=12)
# Viewing and Checking the Created Time Series Data
SLOVENIA_ts
sum(is.na(SLOVENIA_ts))
library(forecast)
SLOVENIA_ts <- tsclean(SLOVENIA_ts)
SLOVENIA_ts

# Identification: Plotting the Time Series Data
plot(SLOVENIA_ts)

# Estimating the appropriate model
SLOVENIA_ts_model <- auto.arima(SLOVENIA_ts)
SLOVENIA_ts_model

# Forecasting
options(max.print=1000000)
SLOVENIA_ts_forecast <- forecast (SLOVENIA_ts_model, level=c(95), h=288)
plot(SLOVENIA_ts_forecast)
SLOVENIA_ts_forecast             

# Exporting
write.table(SLOVENIA_ts_forecast, file="/users/Biniam/Desktop/Documents/Academic/Thesis/Result Folder/TSA Results/Excel Files/From R/Aluminium/SLOVENIA_TSA.csv", sep=",")
